<?php
/**
 * Magento
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Academic Free License (AFL 3.0)
 * that is bundled with this package in the file LICENSE_AFL.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/afl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magentocommerce.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magentocommerce.com for more information.
 *
 * @category    design
 * @package     base_default
 * @copyright   Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
 * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */
?>
<?php if($this->getResultCount()): ?>
<?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
<div class="page-title title-all-page">
    <?php 
        $request = $this->getRequest()->getParam("q"); ?>
        
        <?php if($request!="enabled"):?>
            <h2><?php echo ($this->getHeaderText() || $this->getHeaderText() === false) ? $this->getHeaderText() : $this->__("Search results for '%s'", $this->helper('catalogsearch')->getEscapedQueryText()) ?></h2> 
        <?php else: ?>
            
            <?php $optionId = $this->getRequest()->getParam("manufacturer"); ?>
            
            <?php if(!empty($optionId)):?>
            
                <?php 
                    $label = "";
                    $attribute = Mage::getModel('eav/config')->getAttribute('catalog_product', 'manufacturer');

                    foreach ( $attribute->getSource()->getAllOptions(true, true) as $option){
                        if($option['value']==$optionId){
                            $label = $option['label'];
                            break;
                        }
                    }  
                    
                ?>
                <h2><?php echo $this->__("Sản Phẩm Của: ".$label); ?></h2>
            <?php endif; ?>
        <?php endif; ?>
    
    
    <ul>
        <li><?php echo $this->__("Share this shop and") ?> <span><?php echo $this->__("earn cash") ?></span></li>
        <li>
            <a title="" href="#"><img alt="" class="ui-icon icon-10" src="<?php echo $this->getSkinUrl("images/dummy.gif")?>" ></a>
            <a title="" href="#"><img alt="" class="ui-icon icon-11" src="<?php echo $this->getSkinUrl("images/dummy.gif")?>"></a>
            <a title="" href="#"><img alt="" class="ui-icon icon-12" src="<?php echo $this->getSkinUrl("images/dummy.gif")?>"></a>
            <a title="" href="#"><img width="73" height="20" alt="" src="<?php echo $this->getSkinUrl("images/img_fb.jpg")?>"></a>
        </li>
    </ul>
</div>

<?php if ($messages = $this->getNoteMessages()):?>
<p class="note-msg">
    <?php foreach ($messages as $message):?>
        <?php echo $message?><br />
    <?php endforeach;?>
</p>
<?php endif; ?>
<?php echo $this->getProductListHtml() ?>
<?php else: ?>
<div class="page-title">
    <?php $request = $this->getRequest()->getParam("q"); ?>
    <?php if($request!="enabled"):?>
        <h2><?php echo ($this->getHeaderText() || $this->getHeaderText() === false) ? $this->getHeaderText() : $this->__("Search results for '%s'", $this->helper('catalogsearch')->getEscapedQueryText()) ?></h2> 
    <?php else:?>    
         <?php $optionId = $this->getRequest()->getParam("manufacturer"); ?>
         <?php if(!empty($optionId)):?>   
            <h2><?php echo $this->__("Đại lý này chưa có sản phẩm")?></h2>
         <?php endif;?>
    <?php endif;?>        
</div>
<p class="note-msg">
    <?php echo ($this->getNoResultText()) ? $this->getNoResultText() : $this->__('Your search returns no results.') ?>
    <?php if ($messages = $this->getNoteMessages()):?>
        <?php foreach ($messages as $message):?>
        <br /><?php echo $message?>
        <?php endforeach;?>
    <?php endif; ?>
</p>
<?php endif; ?>
